package org.jxc.vo;

import java.util.Iterator;
import java.util.List;

/**
 * <p>
 * 程序名称： KeyValue.java
 * </p>
 * <p>
 * 程序说明： 键值对对象
 * </p>
 * <p>
 * 版权信息： Copyright 深圳市维远泰克科技有限公司
 * </p>
 * <p>
 * 时间： Feb 22, 2011 3:22:57 PM
 * </p>
 * 
 * @author： Marker.King
 * @version： Ver 0.1
 */
public class KeyValue {
	
	private Object key;
	private Object value;
	private String html;
	
	public static Object getValue(List<KeyValue> list, Object key) {
		for (Iterator iterator = list.iterator(); iterator.hasNext();) {
			KeyValue keyValue = (KeyValue) iterator.next();
			if(keyValue.getKey().equals(key)) {
				return keyValue.getValue();
			}
		}
		return null;
	}
	
	public static Object getHtml(List<KeyValue> list, Object key) {
		for (Iterator iterator = list.iterator(); iterator.hasNext();) {
			KeyValue keyValue = (KeyValue) iterator.next();
			if(keyValue.getKey().equals(key)) {
				return keyValue.getHtml();
			}
		}
		return null;
	}
	
	public KeyValue(Object key, Object value, String html) {
		super();
		this.key = key;
		this.value = value;
		this.html = html;
	}

	public Object getKey() {
		return key;
	}

	public void setKey(Object key) {
		this.key = key;
	}

	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}

	public String getHtml() {
		return html;
	}

	public void setHtml(String html) {
		this.html = html;
	}
}
